<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    p {
      margin: 0;
    }
    body {
      perspective: 1000px;
    }
    div {
      width: 200px;
      height: 300px;
      border: 10px solid red;
      margin: 0 auto;
      transition: all 4s;
      /* 让子盒子3d效果显示，默认2d */
      transform-style: preserve-3d;
    }
    div:hover {
      transform: rotateY(180deg)
    }
    p {
      width: 200px;
      height: 300px;
      background-color: pink;
      transform: rotateY(45deg)
    }
  </style>
</head>
<body>
  <div>
    <p></p>
  </div>
</body>
</html>